var RUBase = Backbone.View.extend({
	initialize : function() {
		this.render();
	},
	line : false,
	render : function() {
		var html = $('#table_search_template').html();
		this.ui = $(html);
		this.$el.html(this.ui);
		this.module = this.options.module;
		this.toggler = new FlipButton({
			el : $('.switch', this.$el)
		}).register(this);
		this.searchLine = $('.search-line', this.$el)
		this.inputsView = new InputList({
			el : $('.inputs', this.$el),
			model : ViewData[this.module].input,
			result : $('.result-table', this.$el)
		});
		this.helper = $("<div class='view-helper'></div>").appendTo(this.ui);
		this.tableView = new Table({
			el : $('.result-table', this.$el),
			model : ViewData[this.module].table,
			head : ViewData[this.module].table_head
		});

	},
	update : function() {
		var table = this.tableView.$el;
		var inputs = this.inputsView.$el;
		var igrid = this.inputsView.lineGrid;
		if (this.line) {
			// table.hide();
						this.helper.append(table).hide();
			// table.prependTo($(".panel-body", util.getBlock(this.module)));
			inputs.width(600);
		} else {
			inputs.css('width', '');
			if(table.parent().hasClass('view-helper'));
				this.searchLine.after(table);
			// if (table.is(':hidden')){
				// table.show();
				// console.log('shown!')
				// }
			// if (!this.searchLine.next().is(table)) {
				// this.searchLine.after(table);
			// }
		}
		setTimeout(
		function(){
		if (igrid)
			igrid.restore(true);
			}, 300);
	}
}); 